package xyz.chaobei.jpa.reposity;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import xyz.chaobei.jpa.model.OrgUser;

/**
 * @author <a href='mailto:maruichao52@gmail.com'>MRC</a>
 * @since 2021/4/25
 */
@Repository
public interface OrgUserRepository extends CrudRepository<OrgUser, Integer> {

    /**
     * <p>
     * <p>author: <a href='mailto:maruichao52@gmail.com'>MRC</a>
     *
     * @param username 用户名
     * @param password 密码
     * @return xyz.chaobei.jpa.model.OrgUser
     * @since 2021/4/25
     **/
    OrgUser findOrgUserByUsernameAndPassword(String username, String password);

    /**
     * <p>通过类参数来查询
     * <p>author: <a href='mailto:maruichao52@gmail.com'>MRC</a>
     *
     * @param id 参数
     * @return xyz.chaobei.jpa.model.OrgUser
     * @since 2021/4/25
     **/
    @Query("select u from OrgUser u where u.id=?1")
    OrgUser selectById(Integer id);

}
